//
//  LocationModel.m
//  Anda_Driver_Pro
//
//  Created by AnDa-Y on 2018/7/9.
//  Copyright © 2018年 chuangxing-1. All rights reserved.
//

#import "ADLocationModel.h"
#import <objc/runtime.h>
#import <CoreLocation/CoreLocation.h>

@implementation ADLocationModel

- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {
    
    if (self = [super init]) {
        
        unsigned int outCount;
        
        Ivar * ivars = class_copyIvarList([self class], &outCount);
        
        for (int i = 0; i < outCount; i ++) {
            
            Ivar ivar = ivars[i];
            
            NSString * key = [NSString stringWithUTF8String:ivar_getName(ivar)];
            
            [self setValue:[aDecoder decodeObjectForKey:key]?[aDecoder decodeObjectForKey:key]:@"" forKey:key];
            
        }
    }
    return self;
}

- (void)encodeWithCoder:(NSCoder *)aCoder {
    
    unsigned int outCount;
    
    Ivar * ivars = class_copyIvarList([self class], &outCount);
    
    for (int i = 0; i < outCount; i ++) {
        
        Ivar ivar = ivars[i];
        
        NSString * key = [NSString stringWithUTF8String:ivar_getName(ivar)];
        
        [aCoder encodeObject:[self valueForKey:key] forKey:key];
    }
}

- (NSString *)uuid
{
    return [NSString stringWithFormat:@"%f",self.time];
}

@end

@implementation ADMinLocationModel
@end
